﻿using System.Threading;
using System.Threading.Tasks;

namespace FileStorage.Security
{
    public interface IFileTokenManager
    {
        /// <summary>
        /// 发放文件访问令牌
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="client"></param>
        /// <param name="expires">令牌有效期，分钟</param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask<string> IssueAsync(string uri, string client, int expires, CancellationToken cancellation);

        /// <summary>
        /// 校验文件访问令牌
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="token"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask<bool> ValidateAsync(string uri, string token, CancellationToken cancellation);
    }
}